package com.jmb.waimao.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jmb.waimao.entity.SocialMediaUser;

import java.util.List;
import java.util.Map;

/**
 * Service interface for SocialMediaUser
 */
public interface SocialMediaUserService extends IService<SocialMediaUser> {
    
    /**
     * Crawl users from Facebook
     * 
     * @param keywords Keywords to search for
     * @param maxUsers Maximum number of users to crawl
     * @return List of crawled users
     */
    List<SocialMediaUser> crawlFacebookUsers(List<String> keywords, int maxUsers);
    
    /**
     * Crawl users from Instagram
     * 
     * @param keywords Keywords to search for
     * @param maxUsers Maximum number of users to crawl
     * @return List of crawled users
     */
    List<SocialMediaUser> crawlInstagramUsers(List<String> keywords, int maxUsers);
    
    /**
     * Crawl users from Twitter/X
     * 
     * @param keywords Keywords to search for
     * @param maxUsers Maximum number of users to crawl
     * @return List of crawled users
     */
    List<SocialMediaUser> crawlTwitterUsers(List<String> keywords, int maxUsers);
    
    /**
     * Get users by platform with pagination
     * 
     * @param platform Platform name
     * @param page Page number
     * @param size Page size
     * @return Paged list of users
     */
    Page<SocialMediaUser> getUsersByPlatform(String platform, int page, int size);
    
    /**
     * Export users to CSV file
     * 
     * @param platform Platform name (optional)
     * @return CSV file content as byte array
     */
    byte[] exportUsersToCsv(String platform);
    
    /**
     * Get statistics by platform
     * 
     * @return Map of platform to user count
     */
    Map<String, Long> getStatisticsByPlatform();
    
    /**
     * Convert social media users to email addresses
     * 
     * @param userIds List of user IDs
     * @param groupName Group name for the email addresses
     * @return Number of email addresses created
     */
    int convertToEmailAddresses(List<Long> userIds, String groupName);
}
